/**
 * 根据共同的配置修改或者直接自定义个性化的配置
 */

import {
  commonProtoConfig,
  defaultChartOptions,
} from '@/components/common/VisualizationComp/ChartConfig/common'
import { cloneDeep } from 'lodash'

const {
  titleConfig,
  tooltipConfig,
  rightLegendConfig,
  xAxis,
  yAxis,
  labelConfig,
  themeColorDiscreteConfig,
  lineSmoothConfig,
  scaleConfig,
} = commonProtoConfig

const copyYAxis: any = cloneDeep(yAxis)
copyYAxis[0].children.push({
  type: 'inputNumber',
  label: '基准值',
  name: 'yAnnotation',
  // @ts-ignore
  defaultValue: 0,
})

export const protoConfig = [
  {
    label: '',
    type: 'property',
    children: [
      ...titleConfig,
      ...xAxis,
      ...copyYAxis,
      ...labelConfig,
      ...rightLegendConfig,
      ...tooltipConfig,
      ...lineSmoothConfig,
      ...scaleConfig,
      ...themeColorDiscreteConfig,
    ],
  },
]
/**
 * 图表渲染的默认配置
 */
export const defaultOptions = {
  ...defaultChartOptions,
}
